SOAP Server did not recognize
Merhaba;
web serverdan verileri çekmeye çalışıyorum fakat bir türlü çekemedim. "Server did not recognize the value of HTTP Header SOAPAction" hatası dönmekte sürekli. Neyi kaçırıyor olabilirim.
[code]
package com.erben.erben_pdks;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
//import com.prgguru.android.MainActivity.AsyncCallWS;
import android.app.Activity;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
public class Verial extends Activity implements OnClickListener{
private ProgressBar progressBar;
private int progressStatus = 0;
private TextView textView;
private Button button1;
private EditText et;
private TextView tv;
private Handler handler = new Handler();
private final String NAMESPACE = "http://192.168.0.4/pdaservis/";
private final String URL = "http://192.168.0.4/pdaservis/pdaservis.asmx";
private final String SOAP_ACTION = "http://192.168.0.4/pdaservis/pdaservis/GetUser";
private final String METHOD_NAME = "GetUser";
private String[] Liste;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.verial);
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
textView = (TextView) findViewById(R.id.textView1);
button1=(Button)findViewById(R.id.button1);
et=(EditText) findViewById(R.id.editText1);
tv=(TextView)findViewById(R.id.textView2);
button1.setOnClickListener(this);
// Start long running operation in a background thread
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.button1 :
AsyncCallWS task = new AsyncCallWS();
//Call execute
task.execute();
break;
}
}
private void basla(){
new Thread(new Runnable() {
public void run() {
while (progressStatus < 100) {
progressStatus += 1;
// Update the progress bar and display the current value in the text view
handler.post(new Runnable() {
public void run() {
progressBar.setProgress(progressStatus);
textView.setText(progressStatus+"/"+progressBar.getMax());
}
});
try {
// Sleep for 200 milliseconds. Just to display the progress slowly
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
public void getWebService(String _State,String _UserName,String _Password ) {
//Create request
//SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//Property which holds input parameters
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo parametre1 = new PropertyInfo();
//parametre1.name="_Password";
parametre1.setName("_State");
parametre1.setValue(_State);
//parametre1.type=PropertyInfo.STRING_CLASS;
parametre1.setType(String.class);
request.addProperty(parametre1);
PropertyInfo parametre2 = new PropertyInfo();
//parametre2.name="_UserName";
parametre2.setName("_UserName");
parametre2.setValue(_UserName);
parametre2.setType(String.class);
//parametre2.type=PropertyInfo.STRING_CLASS;
request.addProperty(parametre2);
PropertyInfo parametre3 = new PropertyInfo();
//parametre3.name="_Password";
parametre3.setName("_Password");
parametre3.setValue(_Password);
//parametre3.type=PropertyInfo.STRING_CLASS;
parametre3.setType(String.class);
request.addProperty(parametre3);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
//envelope.bodyOut=request;
envelope.dotNet = true;
//Set output SOAP object
envelope.setOutputSoapObject(request);
//Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
//androidHttpTransport.debug = true;
try {
//Invole web service
androidHttpTransport.call(SOAP_ACTION, envelope);
//Get the response
//SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
SoapObject response = (SoapObject) envelope.getResponse();
//Assign it to fahren static variable
Liste = new String[response.getPropertyCount()];
System.out.println("web yaratıldı girdi");
for(int i=0;i<response.getPropertyCount();i++){
System.out.println(response.getProperty(i).toString().trim());
Liste[i] = response.getProperty(i).toString().trim(); //Sırasıyla string cinsinden gelen sonuçları listeye atıyoruz.
}
} catch (Exception e) {
e.printStackTrace();
}
}
private class AsyncCallWS extends AsyncTask<String, Void, Void> {
private ProgressDialog dialog = new ProgressDialog(Verial.this);
protected Void doInBackground(String... params) {
Log.i("----çelmeye çalıyor-----", "String[] doInBackground");
getWebService("1", "Test", "Test123");
return null;
}
@Override
protected void onPostExecute(Void result) {
Log.i("----onPostExecute çalıyor-----", "onPreExecute");
dialog.setMessage("Yükleniyor...");
dialog.show();
tv.setText("Calculating...");
}
@Override
protected void onPreExecute() {
Log.i("----onPreExecute çalıyor-----", "onPreExecute");
}
@Override
protected void onProgressUpdate(Void... values) {
Log.i("----onProgressUpdate çalıyor-----", "onProgressUpdate");
dialog.dismiss();
}
}
}
[/code]
[code]
12-03 22:00:09.340: I/----onPreExecute çalıyor-----(27540): onPreExecute
12-03 22:00:09.350: I/----çelmeye çalıyor-----(27540): String[] doInBackground
12-03 22:00:15.160: W/System.err(27540): SoapFault - faultcode: 'soap:Client' faultstring: 'Server did not recognize the value of HTTP Header SOAPAction: http://192.168.0.4/pdaservis/pdaservis/GetUser.' faultactor: 'null' detail: org.kxml2.kdom.Node@40595058
12-03 22:00:15.160: W/System.err(27540): at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:112)
12-03 22:00:15.160: W/System.err(27540): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
12-03 22:00:15.160: W/System.err(27540): at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
12-03 22:00:15.160: W/System.err(27540): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
12-03 22:00:15.160: W/System.err(27540): at com.erben.erben_pdks.Verial.getWebService(Verial.java:139)
12-03 22:00:15.160: W/System.err(27540): at com.erben.erben_pdks.Verial$AsyncCallWS.doInBackground(Verial.java:161)
12-03 22:00:15.170: W/System.err(27540): at com.erben.erben_pdks.Verial$AsyncCallWS.doInBackground(Verial.java:1)
12-03 22:00:15.170: W/System.err(27540): at android.os.AsyncTask$2.call(AsyncTask.java:185)
12-03 22:00:15.170: W/System.err(27540): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
12-03 22:00:15.170: W/System.err(27540): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
12-03 22:00:15.170: W/System.err(27540): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
12-03 22:00:15.170: W/System.err(27540): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
12-03 22:00:15.170: W/System.err(27540): at java.lang.Thread.run(Thread.java:1019)
12-03 22:00:15.170: I/----onPostExecute çalıyor-----(27540): onPreExecute[/code]